﻿using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Ewk.UnitTests
{
    public abstract class UnitTestBase
    {
        protected MockHelper MockHelper { get; private set; }

        [TestInitialize]
        public void Setup()
        {
            MockHelper = new MockHelper();

            AdditionalSetup();

            MockHelper.Replay();
        }

        [TestCleanup]
        public void Teardown()
        {
            MockHelper.Dispose();
            MockHelper = null;

            AdditionalTearDown();
        }

        /// <summary>
        /// Override this method in deriving classes to add setup logic for a test.
        /// </summary>
        protected virtual void AdditionalSetup()
        {
        }

        /// <summary>
        /// Override this method in deriving classes to add teardown logic for a test.
        /// </summary>
        protected virtual void AdditionalTearDown()
        {
        }
    }
}